home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_kdelibs.idb / usr / freeware / kde / include / dither.h.z / dither.h
Encoding:
C/C++ Source or Header  |  1999-01-26  |  1.6 KB  |  64 lines

  1. /* This file is part of the KDE libraries
  2.     Copyright (C) 1997 Martin Jones (mjones@kde.org)
  3.  
  4.     This library is free software; you can redistribute it and/or
  5.     modify it under the terms of the GNU Library General Public
  6.     License as published by the Free Software Foundation; either
  7.     version 2 of the License, or (at your option) any later version.
  8.  
  9.     This library is distributed in the hope that it will be useful,
  10.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12.     Library General Public License for more details.
  13.  
  14.     You should have received a copy of the GNU Library General Public License
  15.     along with this library; see the file COPYING.LIB.  If not, write to
  16.     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  17.     Boston, MA 02111-1307, USA.
  18. */
  19. //-----------------------------------------------------------------------------
  20. //
  21. // Floyd-Steinberg dithering
  22. // Ref: Bitmapped Graphics Programming in C++
  23. //      Marv Luse, Addison-Wesley Publishing, 1993.
  24. //
  25.  
  26. #ifndef __DITHER_H__
  27. #define __DITHER_H__
  28.  
  29. #include <qimage.h>
  30.  
  31. /**
  32. * Allows Floyd-Steinberg dithering for low-colour situations.
  33. * @short Floyd-Steinberg dithering.
  34. * @version $Id: dither.h,v 1.1 1998/04/25 13:15:27 mark Exp $
  35. * @author Marv Luse (tm Addison Wesley Publishing)
  36. */
  37. class kFSDither
  38. {
  39. public:
  40.     /**
  41.     */
  42.     kFSDither( const QColor *pal, int pSize );
  43.  
  44.     /**
  45.     */
  46.     QImage dither( const QImage &i );
  47.  
  48. private:
  49.     /**
  50.     */
  51.     int nearestColor( int r, int g, int b );
  52.  
  53. private:
  54.     /**
  55.     */
  56.     const QColor *palette;
  57.     /**
  58.     */
  59.     int palSize;
  60. };
  61.  
  62. #endif    // __DITHER_H__
  63.  
  64.